<?php
if(!defined('InEmpireCMS'))
{
	exit();
}
?>
<?php
$public_diyr['pagetitle']='消息列表';
$url="<a href=../../../>首页</a>&nbsp;>&nbsp;<a href=../cp/>会员中心</a>&nbsp;>&nbsp;消息列表&nbsp;&nbsp;(<a href='AddMsg/?enews=AddMsg'>发送消息</a>)";
require(ECMS_PATH.'e/template/incfile/header.php');
?>
<script>
function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name != 'chkall')
       e.checked = form.chkall.checked;
    }
  }
</script> 

<style>
 thead tr th {
    font-size: 14px;
    color: #666;
    height: 42px;
    line-height: 42px;
    text-align: left;
}
tbody tr td{padding:10px;}
</style>
<!--<a href="AddMsg/?enews=AddMsg">发送消息</a>-->
<div class="center">
	<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
		<form name="listmsg" method="post" action="../doaction.php" onsubmit="return confirm('确认要删除?');">
			<thead>
				<tr class="header"> 
					<th width="4%" height="23"></th>
					<th width="45%">标题</th>
					<th width="18%">发送者</th>
					<th width="23%">发送时间</th>
					<th width="10%">操作</th>
				</tr>
			</thead>
			<tbody>
				<?php
				while($r=$empire->fetch($sql))
				{
					$img="haveread";
					if(!$r[haveread])
					{$img="nohaveread";}
					//后台管理员
					if($r['isadmin'])
					{
						$from_username="<a title='后台管理员'><b>".$r[from_username]."</b></a>";
					}
					else
					{
						$from_username="<a href='../ShowInfo/?userid=".$r[from_userid]."' target='_blank'>".$r[from_username]."</a>";
					}
					//系统信息
					if($r['issys'])
					{
						$from_username="<b>系统消息</b>";
						$r[title]="<b>".$r[title]."</b>";
					}
				?>
				<tr bgcolor="#FFFFFF"> 
					<td height="25">
						<input name="mid[]" type="checkbox" id="mid[]2" value="<?=$r[mid]?>">
					</td>
					<td>
						<img src="../../data/images/<?=$img?>.gif" border=0>
						<a href="ViewMsg/?mid=<?=$r[mid]?>">
							<?=stripSlashes($r[title])?>
						</a>
					</td>
					<td>
						<?=$from_username?>
					</td>
					<td>
					  <?=$r[msgtime]?>
					</td>
					<td>
						<a href="../doaction.php?enews=DelMsg&mid=<?=$r[mid]?>" onclick="return confirm('确认要删除?');">删除</a>
					</td>
				</tr>
				<?php
				}
				?>
				<tr bgcolor="#FFFFFF"> 
					<td>
					  <input type=checkbox name=chkall value=on onclick=CheckAll(this.form)>
					</td>
					<td colspan="4"><input type="submit" name="Submit2" value="删除选中"> 
						<input name="enews" type="hidden" value="DelMsg_all">
					</td>
				</tr>
				<tr bgcolor="#FFFFFF"> 
					<td></td>
					<td colspan="4"><?=$returnpage?></td>
				</tr>
				<tr bgcolor="#FFFFFF"> 
				  <td height="23" colspan="5"><div align="center">说明：<img src="../../data/images/nohaveread.gif" width="14" height="11"> 
					  代表未阅读消息，<img src="../../data/images/haveread.gif" width="15" height="12"> 
					  代表已阅读消息.</div></td>
				</tr>
			</tbody>	
		</form>
	</table>
</div>		
<?php
require(ECMS_PATH.'e/template/incfile/footer.php');
?>